Skip to content

Add unit test coverage for core modules#473

Open
TimElschner wants to merge 2 commits intoFinsys:mainfrom
TimElschner:tests/add-unit-test-coverage
Open

Add unit test coverage for core modules#473
TimElschner wants to merge 2 commits intoFinsys:mainfrom
TimElschner:tests/add-unit-test-coverage

Conversation

@TimElschner
Copy link
Contributor

@TimElschner TimElschner commented Feb 5, 2026

Summary

  • Adds 110+ unit tests across 7 new test files covering previously untested core modules
  • Exports maskSecrets (git.ts) and escapeTelegramMarkdown (notifications.ts) for direct testability
  • All unit tests run without a Dockhand instance — zero external dependencies

Test Files

File Tests Covers
tests/utils.test.ts 37 compareVersions, shouldShowWhatsNew, computeAuditDiff, formatFieldName, ipToNumber
tests/encryption.test.ts 24 AES-256-GCM encrypt/decrypt roundtrips, isEncrypted, generateKey
tests/git-utils.test.ts 23 maskSecrets, parseEnvFileContent
tests/notifications-utils.test.ts 9 escapeTelegramMarkdown
tests/auth.test.ts 13 Rate limiting (5-attempt lockout), hashPassword/verifyPassword
tests/authorize-helpers.test.ts 4 unauthorized(), forbidden(), enterpriseRequired()
tests/api-smoke.test.ts 10 REST API endpoint smoke tests (requires running instance)

Source Changes (minimal)

  • src/lib/server/git.ts: function maskSecretsexport function maskSecrets
  • src/lib/server/notifications.ts: function escapeTelegramMarkdownexport function escapeTelegramMarkdown

Test plan

  • bun test tests/utils.test.ts — 37 pass
  • bun test tests/encryption.test.ts — 24 pass
  • bun test tests/git-utils.test.ts — 23 pass
  • bun test tests/notifications-utils.test.ts — 9 pass
  • bun test tests/auth.test.ts — 13 pass
  • bun test tests/authorize-helpers.test.ts — 4 pass
  • bun test tests/api-smoke.test.ts — requires running Dockhand instance

🤖 Generated with Claude Code

Adds 110+ tests across 7 new test files covering utilities (version,
diff, ip), encryption, git utils, notification utils, auth logic
(rate limiting, password hashing), and authorization helpers.
Exports maskSecrets and escapeTelegramMarkdown for direct testability.
@TimElschner TimElschner force-pushed the tests/add-unit-test-coverage branch from c6e15b9 to 4164a21 Compare February 6, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant